/*
 * @Author: guo wei
 * @LastEditors: [guo wei]
 * @LastEditTime: 2024-01-18 15:57:01
 * @Description: 
 */
import request from '@/utils/request'

// 查询商品列表
export function getCommodityInfos(query) {
  return request({
    url: '/commodityInfos',
    method: 'get',
    params: query
  })
}
// 新增商品
export function addCommodityInfos(data) {
  return request({
    url: `/commodityInfo`,
    method: 'post',
    data
  })
}
// 修改商品
export function modifyCommodityInfo(data) {
  return request({
    url: `/commodityInfo`,
    method: 'put',
    data
  })
}
// 删除商品
export function deleteMaterialSupplierInfo(data) {
  return request({
    url: `/materialSupplierInfo/${data.materialSupplierInfoId}`,
    method: 'delete',
       params:{recordVersion:data.recordVersion}
  })
}
//查询所有材料分类列表
export function allMaterialCategoryInfo(query) {
  return request({
    url: '/allMaterialCategoryInfo',
    method: 'get',
    params: query
  })
}
//生成邀请码
export function getGenerateInvitationCode(query) {
  return request({
    url: '/materialSupplierInfo/generateInvitationCode',
    method: 'get',
    params: query
  })
}
// 提交商品
export function submitCommodityInfo(data) {
  return request({
    url: `/commodityInfo/submit`,
    method: 'post',
    data
  })
}
//上架商品
export function putOnCommodityInfo(data) {
  return request({
    url: `/commodityInfo/putOn`,
    method: 'post',
    data
  })
}
//上架已下架商品
export function putOnCommodityInfoByAdmin(data) {
  return request({
    url: `/commodityInfo/adminPutOn`,
    method: 'post',
    data
  })
}
//审核商品
export function examineCommodityInfo(data) {
  return request({
    url: `/commodityInfo/audit`,
    method: 'post',
     data:data.commodityInfoIds,
    params:{isPass:data.isPass,reason:data.reason}
  })
}
//下架商品
export function putOffCommodityInfo(data) {
  return request({
    url: `/commodityInfo/putOff`,
    method: 'post',
    data
  })
}
// 删除材料商
export function deleteCommodityInfo(data) {
  return request({
    url: `/commodityInfo/${data.commodityInfoId}`,
    method: 'delete',
       params:{recordVersion:data.recordVersion}
  })
}